package springx;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springx.uitils.Rest;
import springx.uitils.res;

@RestController
@RequestMapping("/nacos")
@NacosPropertySource(groupId = "DEFAULT_GROUP",dataId = "example.properties",autoRefreshed = true)
public class nacosTest {
    @NacosValue(value = "${test:默认值}",autoRefreshed = true)
    private  String test;

    @GetMapping("/test")
    public String protest(){
        return test;
    }

    @RequestMapping("/success")
    public Rest testSuccess(){
        return Rest.SUCCESS("成功返回");
    }

    @RequestMapping("/error")
    public Rest testError(){
        return  Rest.ERROR("失败返回");
    }
}
